<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/pageUtils/template.xhtml">

	<ui:define name="body">
		<h:form prependId="false">
			<div align="left">
				<p:messages id="messages" autoUpdate="true" />
				<p:panel header="Cadastro de locais" style="whidt:800px;">

					<h:panelGrid columns="1" id="painel" width="100%">

						<h:outputText value="Nome :" style="width:100" />
						<p:inputText id="nome" style="width:500;"
							value="#{localController.local.nome}" maxlength="60"
							title="informe o nome do local" />
						<p:tooltip for="nome" showEvent="focus" hideEvent="blur" />

					</h:panelGrid>

					<p:toolbar align="center">
						<p:toolbarGroup align="center">
							<p:commandButton value="Salvar" icon="ui-icon-disk"
								action="#{localController.save()}" update="painelLista" />

							<p:commandButton value="Novo" icon="ui-icon-document"
								action="#{localController.clean()}" update="painel,messages"
								immediate="true" />

							<p:commandButton value="Imprimir" immediate="true"
								icon="ui-icon-print" ajax="false"
								action="#{localController.print()}">
							</p:commandButton>
						</p:toolbarGroup>
					</p:toolbar>

					<h:panelGrid id="painelLista" columns="1">
						<p:dataTable var="listLocais" id="tableLista"
							value="#{localController.locais}" paginator="true" rows="5"
							style="max-width: 800px; min-width: 800px"
							emptyMessage="Nenhum registro.">

							<p:column
								style="max-width: 25px; min-width: 25px; overflow: hidden">
								<f:facet name="header" width="5%">
									<h:outputText value="Codigo" />
								</f:facet>
								<h:outputText value="#{listLocais.id}" />
							</p:column>

							<p:column
								style="max-width: 450px; min-width: 450px; overflow: hidden">
								<f:facet name="header">
									<h:outputText value="Nome" width="95%" />
								</f:facet>
								<h:outputText value="#{listLocais.nome}" />
							</p:column>

							<p:column width="15%">
								<p:commandButton title="Editar" update="painel"
									action="#{localController.editar()}" ajax="false"
									icon="ui-icon-folder-open">
									<f:setPropertyActionListener
										target="#{localController.selected}" value="#{listLocais}" />
								</p:commandButton>
							</p:column>

							<p:column>
								<p:commandButton title="Deletar" update="tableLista"
									ajax="false" action="#{localController.remove()}"
									icon="ui-icon-close">
									<f:setPropertyActionListener
										target="#{localController.selected}" value="#{listLocais}" />
								</p:commandButton>
							</p:column>

						</p:dataTable>
					</h:panelGrid>
				</p:panel>
			</div>
		</h:form>
	</ui:define>
</ui:composition>